package com.imooc.ad.index.adplan;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @Description: TODO
 * @ClassName: AdPlanObject
 * @Author: zhangzhongyu
 * @Date: 2019-10-14 21:48
 * @Version: 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AdPlanObject {

    private Long planId;
    private Long userId;
    private Integer planStatus;
    private Date startDate;
    private Date endDate;

    // 更新的时候不确定更新哪个字段
    public void update(AdPlanObject newObject) {
        if (null != newObject.planId) {
            this.planId = newObject.planId;
        }
        if (null != newObject.userId) {
            this.userId = newObject.userId;
        }
        if (null != newObject.planStatus) {
            this.planStatus = newObject.planStatus;
        }
        if (null != newObject.startDate) {
            this.startDate = newObject.startDate;
        }
        if (null != newObject.endDate) {
            this.endDate = newObject.endDate;
        }

    }
}
